home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / tjgold.zip / INSTALL.003 / DEMLS4.PAS < prev    next >
Pascal/Delphi Source File  |  1995-05-29  |  3KB  |  114 lines

  1. {--------------------------------------------------------------------------}
  2. {                Product: TechnoJock's Turbo Toolkit GOLD                  }
  3. {                                                                          }
  4. {                     TTT GOLD - DEMO PROGRAM                        }
  5. {                                                                          }
  6. {                Copyright 1986-1995  TechnoJock Software, Inc.            }
  7. {                           All Rights Reserved                            }
  8. {                          Restricted by License                           }
  9. {--------------------------------------------------------------------------}
  10.  
  11. {Description: DEMLS4.PAS
  12.               Illustrates how to enable list tagging, and
  13.               then process each tagged item. The example uses
  14.               a list of files
  15. }
  16.  
  17. program DEMLS4;
  18.  
  19. uses   DOS,CRT,
  20.        GoldMisc, GoldLInk, GoldList, GoldKey,
  21.        GoldWin, GoldFast, GoldAttr, GoldStr;
  22.  
  23. var
  24.    Properties: ListCfg;
  25.    Files: DoubleLL;
  26.    I,Counter,
  27.    RetCode: integer;
  28.  
  29. const
  30.    DemoMask: string[12] = '*.*';
  31.  
  32. function BuildTheList: boolean;
  33. {Reads all the files matching DemoMask and returns true if there
  34.  is at least one entry in the list}
  35. var
  36.    SrchRec: SearchRec;
  37. begin
  38.    InitDLLStr(Files);
  39.    DLLSetActiveList(Files);
  40.    findfirst(DemoMask,Anyfile - Hidden - Directory - SysFile - VolumeID,SrchRec);
  41.    while DosError = 0 do
  42.    begin
  43.       if (SrchRec.Attr and Directory <> Directory) then
  44.       begin
  45.          Retcode := DLLAddStr(SrchRec.Name);
  46.          if (Retcode <> 0) then
  47.          begin
  48.             BuildTheList := false;
  49.             exit;
  50.          end;
  51.       end;
  52.       findnext(SrchRec);
  53.    end;
  54.    DLLSort(0,true);
  55. end; { BuildTheList }
  56.  
  57. procedure SetScreen;
  58. {Paints the background}
  59. begin
  60.    Clear(WhiteOnBlack,'░');
  61.    ClearLine(1,YellowOnBlue);
  62.    WriteCenter(1,UseTint,' A Simple List Window ');
  63.    ClearLine(25,YellowOnBlue);
  64.    WriteHiCenter(25,YellowOnBlue,LightgrayOnBlue,'~T~ tag  ~U~ untag  ~SPACE~ toggle  ~Alt-T~ tag all'+
  65.                                              '  ~Alt-U~ untag all, or use mouse');
  66.    GotoXY(1,1);
  67. end; {SetScreen}
  68.  
  69. begin
  70. {$IFOPT D+}
  71.    HeapRecord;
  72. {$ENDIF}
  73.    SetScreen;
  74.    if not BuildTheList then
  75.       PromptOK(' Error ','Unable to build the list')
  76.    else
  77.    begin
  78.       InitListCfg(Properties);
  79.       ListAssignDLL(Properties,Files);
  80.       ListSetColWidth(Properties,15);
  81.       ListSetWin(Properties, 5,3,75,23,1);
  82.       ListSetTagging(Properties, true);
  83.       MouseShow(true);
  84.       CursorOff;
  85.       RunList(Properties,' Tag some files! ');
  86.       MouseShow(false);
  87.       {now list the selected files}
  88.       ResetStartUpMode;
  89.       clear(YellowOnBlue,' ');
  90.       Writeln('You tagged the following files:');
  91.       Counter := 0;
  92.       for I := 1 to Properties.TotalNodes do
  93.       begin
  94.          if DLLGetBit(DLLNodePtr(I),TagBit) then
  95.          begin
  96.             writeln(DLLGetStr(I));
  97.             inc(Counter);
  98.          end;
  99.          if (Counter <> 0) and (Counter mod 24 = 0) then
  100.          begin
  101.             write('Press any key...');
  102.             GetInput;
  103.             writeln;
  104.             Clear(YellowOnBlue,' ');
  105.          end;
  106.       end;
  107.    end;
  108.    DLLSetActiveList(Files);
  109.    DLLDestroy;
  110. {$IFOPT D+}
  111.    HeapCheck;
  112. {$ENDIF}
  113. end. { DEMLS4 }
  114.